package com.atguigu.lease.common.utils;

import java.util.Random;

/**
 * 根据传入的长度生成随机数字验证码；
 */
public class CodeUtil {
    public static String getRandomCode(Integer length){
        StringBuilder builder = new StringBuilder();
        Random random = new Random();
        for (int i = 0 ; i < length ; i ++){
            int num = random.nextInt(10);
            builder.append(num);
        }
        return builder.toString();
    }
}
